cmake_minimum_required(VERSION 3.22)
project(yolov8detect)

add_compile_options(-std=c++11 -fPIC -fstack-protector-all -g -Wl,-z,relro,-z,now,-z -pie -Wall)
add_definitions(-D_GLIBCXX_USE_CXX11_ABI=0 -Dgoogle=mindxsdk_private)

set(OUTPUT_NAME "yolov8detect")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}")

set(MX_SDK_HOME "/usr/local/Ascend/mxVision")
set(FFMPEG_PATH "/usr/local/Ascend/thirdpart/aarch64/")

set(LIB_PATH $ENV{NPU_HOST_LIB})
set(INC_PATH $ENV{NPU_HOST_INC})


include_directories(
        ${MX_SDK_HOME}/include
        ${MX_SDK_HOME}/opensource/include
        ${MX_SDK_HOME}/opensource/include/opencv4
        ${FFMPEG_PATH}/include

        ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/libhdmi/include
        ${INC_PATH}/acl/media
)

link_directories(
        ${MX_SDK_HOME}/lib
        ${MX_SDK_HOME}/opensource/lib
        ${MX_SDK_HOME}/lib/modelpostprocessors
        ${FFMPEG_PATH}/lib
        /usr/local/Ascend/ascend-toolkit/latest/acllib/lib64
)


add_executable(${OUTPUT_NAME} main.cpp VideoProcess/VideoProcess.cpp VideoProcess/VideoProcess.h
        Yolov8Detection/Yolov8Detection.cpp Yolov8Detection/Yolov8Detection.h
        yolov8PostProcess/Yolov8PostProcess.cpp yolov8PostProcess/Yolov8PostProcess.h)


target_link_libraries(${OUTPUT_NAME}
        avcodec
        avdevice
        avfilter
        avformat
        avcodec
        avutil
        swscale
        swresample
        glog
        mxbase
        cpprest
        opencv_world
        pthread m
        )

